<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bai 3.1</title>
</head>

<body>
<?php
	if(isset($_POST['dayso']))
	{
		$dayso=$_POST['dayso'];
		$mang=explode(",",$dayso);
		$kq=0;
		for($i=0;$i<count($mang);$i++)
		{
				$kq+=$mang[$i];
		}
	}
?>
<form id="form1" name="form1" method="post" action="Bai3_1.php">
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr bgcolor="#006666" style="text-align: center; font-size: 24px; color: #FFF; font-weight: bold;">
      <td colspan="2" nowrap="nowrap">NHẬP VÀ TÍNH TRÊN DÃY SỐ</td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#00CCCC">Nhập dãy số:</td>
      <td nowrap="nowrap" bgcolor="#00CCCC"><input name="dayso" type="text" id="dayso" value="<?php echo $_POST['dayso'];?>" size="50" /> <label style="color: #F00; font-weight: bold;">(*)</label></td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#00CCCC">&nbsp;</td>
      <td nowrap="nowrap" bgcolor="#00CCCC"><input type="submit" name="submit" id="submit" value="Tổng dãy số" /></td>
    </tr>
    <tr>
      <td nowrap="nowrap" bgcolor="#00CCCC">Tổng dãy số:</td>
      <td nowrap="nowrap" bgcolor="#00CCCC"><input name="kq" type="text" disabled="disabled" id="kq" value="<?php echo $kq;?>" /></td>
    </tr>
    <tr style="text-align: center">
      <td colspan="2" bgcolor="#00CCCC"><span style="color: #F00; font-weight: bold;">(*)</span> Các số được nhập cách nhau bằng dấu &quot;,&quot;</td>
    </tr>
  </table>
</form>
</body>
</html>